import java.util.Scanner;
import java.util.Arrays;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    //组队竞赛
    public static void main1(String[] args) {
        Scanner input = new Scanner(System.in);
        while(input.hasNext()) {
            int n = input.nextInt();
            int[] arr = new int[3 * n];
            for(int i = 0; i < arr.length; i++){
                arr[i] = input.nextInt();
            }
            Arrays.sort(arr);
            long ret = 0;
            for(int i = 0; i < n; i++){
                int index = 3 * n - i * 2 - 2;
                ret += arr[index];
                // System.out.println(arr[index]);
            }
            System.out.println(ret);
        }
    }

    //删除公共字符
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while(input.hasNext()) {
            String str1 = input.nextLine();
            String str2 = input.nextLine();
            int[] arr = new int[128];
            for(int i = 0; i < str2.length(); i++) {
                int index = str2.charAt(i);
                arr[index] = 1;
            }
            StringBuilder ret = new StringBuilder();
            for(int i = 0; i < str1.length(); i++) {
                int index = str1.charAt(i);
                if(arr[index] == 0) {
                    ret.append(str1.charAt(i));
                }
            }
            System.out.println(ret);
        }
    }
}